from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains

# 打开浏览器
driver = webdriver.Chrome()
driver.get('https://yuedu.163.com/')
sleep(2)
# 窗口最大化
driver.maximize_window()
sleep(2)
# 悬停在登录上
xt = driver.find_element(By.XPATH, '/html/body/div[1]/div[1]/div[1]/div[1]/div/div[2]/div/a[1]')
ActionChains(driver).move_to_element(xt).perform()
sleep(2)
# 点击手机号密码登录
driver.find_element(By.PARTIAL_LINK_TEXT, '手机号登录').click()
sleep(2)
# 输入手机号
driver.find_element(By.NAME, 'cellPhone').send_keys('15985645480')
sleep(2)
# 输入密码
driver.find_element(By.NAME, 'password').send_keys('gW09092434')
sleep(2)
# 点击登录按钮
driver.find_element(By.CLASS_NAME, 'row.row-2').click()
sleep(10)
